]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
panel: Hide app menu when disabled by settings
authorFlorian Müllner <fmuellner@gnome.org>
Tue, 10 Mar 2015 14:33:50 +0000 (15:33 +0100)
committerFlorian Müllner <fmuellner@gnome.org>
Mon, 5 Oct 2015 12:08:20 +0000 (14:08 +0200)
While the GtkSettings::gtk-shell-shows-app-menu property is meant to
reflect a desktop capability (i.e. in the GNOME case: the app menu is
shown in the top bar), it is possible for users to overwrite it.
Respect the setting and actually hide the menu in that case.

https://bugzilla.gnome.org/show_bug.cgi?id=745919

js/ui/panel.js

index a1b89a64504a568e33b6a64d9a33918b68e3edfd..19336811f11d81eaae7b50cb4668c53a89b45838 100644 (file)
@@ -95,6 +95,7 @@ const AppMenuButton = new Lang.Class({
         this._startingApps = [];
 
         this._menuManager = panel.menuManager;
+        this._gtkSettings = Gtk.Settings.get_default();
         this._targetApp = null;
         this._appMenuNotifyId = 0;
         this._actionGroupNotifyId = 0;
@@ -123,11 +124,14 @@ const AppMenuButton = new Lang.Class({
         this._arrow = PopupMenu.arrowIcon(St.Side.BOTTOM);
         this._container.add_actor(this._arrow);
 
-        this._visible = !Main.overview.visible;
+        this._visible = this._gtkSettings.gtk_shell_shows_app_menu &&
+                        !Main.overview.visible;
         if (!this._visible)
             this.actor.hide();
         this._overviewHidingId = Main.overview.connect('hiding', Lang.bind(this, this._sync));
         this._overviewShowingId = Main.overview.connect('showing', Lang.bind(this, this._sync));
+        this._showsAppMenuId = this._gtkSettings.connect('notify::gtk-shell-shows-app-menu',
+                                                         Lang.bind(this, this._sync));
 
         this._stop = true;
 
@@ -305,7 +309,9 @@ const AppMenuButton = new Lang.Class({
             }
         }
 
-        let visible = (this._targetApp != null && !Main.overview.visibleTarget);
+        let visible = (this._targetApp != null &&
+                       this._gtkSettings.gtk_shell_shows_app_menu &&
+                       !Main.overview.visibleTarget);
         if (visible)
             this.show();
         else
@@ -378,6 +384,10 @@ const AppMenuButton = new Lang.Class({
             Main.overview.disconnect(this._overviewShowingId);
             this._overviewShowingId = 0;
         }
+        if (this._showsAppMenuId > 0) {
+            this._gtkSettings.disconnect(this._showsAppMenuId);
+            this._showsAppMenuId = 0;
+        }
         if (this._switchWorkspaceNotifyId > 0) {
             global.window_manager.disconnect(this._switchWorkspaceNotifyId);
             this._switchWorkspaceNotifyId = 0;